import * as React from 'react';
import { LoginLogic } from '../../allLogics/components';
import { ILoginState } from '../../allLogics';
import { Inital } from './inital';
import { Redirect } from 'react-router-dom';

interface IState {
    inital: boolean;
}
export class LoginPage extends React.Component<ILoginState, IState> {
    constructor(props: ILoginState) {
        super(props);
        this.state = {
            inital: true,
        };
    }
    // 初始化数据，成功ze改名为dave
    private model = new LoginLogic();

    public toHome = () => {
        this.setState({
            inital: false,
        });
    };

    public render() {
        if (this.state.inital) {
            return <Inital toHome={this.toHome} />;
        }
        // 若用户不用初始化则重定向到home页面啊
        return <Redirect to="/home/homeMall" />;
    }
}
